package com.enjoy.redis;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.redis.core.StringRedisTemplate;


@SpringBootApplication
public class App {

    static Logger logger = LoggerFactory.getLogger("enjoy");

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(App.class, args);

//        Jedis jedis = (Jedis) context.getBean("jedis");
//
//        logger.info(jedis.set("aa", "aa"));
//
//        logger.info(jedis.get("aa"));
//
//        JedisPool jedisPool = (JedisPool) context.getBean("jedisPool");
//
//        logger.info(jedisPool.getResource().set("aa", "aa"));
//

//        JedisCluster jedisCluster = (JedisCluster) context.getBean("jedisCluster");
//
//        jedisCluster.set("enjoy", "enjoy");
//
//        System.out.println("enjoy" + jedisCluster.get("enjoy"));
//
//
        StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) context.getBean("stringRedisTemplate");

        stringRedisTemplate.opsForValue().set("ii", "ii");

        System.out.println("ii = " + stringRedisTemplate.opsForValue().get("ii"));

//        JedisSentinelPool jedisSentinelPool = (JedisSentinelPool) context.getBean("jedisSentinelPool");
//
//        Set<String> keys = jedisSentinelPool.getResource().keys("*");
//
//        System.out.println("keys = " + keys);
    }
}
